<body>
  <input type="file" value="上传文件" id="inp" />
  <button id="btn">获取文件</button>
</body>
<script>
  const oInp = document.querySelector("#inp");
  const btn = document.querySelector("#btn");
  const {
    files: [file],
  } = oInp;
  btn.onclick = () => {
    console.log(file.slice(0,500), "=====文件");
  };
</script>
